import request from '@/utils/request'

// mock+api示例。后端接口路径/api/posCategory/list，mock路径/posCategory/list。
// 查询图书类别列表
export function listCategory(query) {
  return request({
    url: '/posCategory/list', //默认mock模拟数据
    method: 'get',
    params: query
  })
}

// 查询商品类别
export function getCategory(categoryId) {
  return request({
    url: '/api/posCategory/' + categoryId,
    method: 'get'
  })
}

// 新增商品类别
export function addCategory(data) {
  return request({
    url: '/api/posCategory',
    method: 'post',
    data: data
  })
}

// 修改商品类别
export function updateCategory(data) {
  return request({
    url: '/api/posCategory',
    method: 'put',
    data: data
  })
}

// 删除商品类别
export function deleteCategory(categoryId) {
  return request({
    url: '/api/posCategory/delete/' + categoryId,
    method: 'delete'
  })
}